<?php

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $searchModel mdm\admin\models\searchs\Menu */

use yii\helpers\Url;
use common\widgets\tree\JsTree;

$this->title = Yii::t('rbac-admin', 'Menus');
$this->params['consoleactions'] = [
    [
        'label' => '<i class="fal fa-plus"></i> ' . Yii::t('rbac-admin', 'Create Menu'),
        'url' => ['create'],
        'options' => ['class' => 'btn-success']
    ],
    [
        'label' => '<i class="far fa-layer-group"></i> 更新层级关系',
        'url' => ['refresh'],
        'options' => ['class' => 'btn-light-primary'],
    ],
    [
        'label' => '<i class="fal fa-eraser"></i> 清除无效菜单',
        'url' => ['filter'],
    ],
];

echo JsTree::widget([
    'label' => 'Action',
    'options' => [
        'class' => 'rbac-menu',
    ],
    'treeOptions' => [
        'uri' => Url::to('menu'),
        'modal' => 'jstree-modal',
        'menus' => [
            'rename' => '重命名',
            'update' => '修改',
            'remove' => '删除',
            'hide' => '隐藏',
        ],
    ],
]);

